//http://myfigurecollection.net/figure/recent_changes/
import javax.swing.*;
import java.io.*;
import java.awt.*;
public class Node implements Serializable{
	String name;
	double bust, waist, hips, cI;
	ImageIcon img;
	Node next;
	Node previous; // useful only for the tail node
	//this is the formula constructed for calculation the curvature index
	public double solve(double bust, double waist, double hips){
		
		double bustI = 0, waistI = 0, hipsI = 0;
		if(bust<=36){
			bustI = 1 - ((36 - bust) / 36); 
		}
		if(bust>36){
			bustI = 1 - ((bust - 36) / 36);
		}
		if(waist<23){
			waistI = 1 - ((24 - waist) / 24);
		}
		if(waist==23){
			waistI = 1 + ((24 - waist) / 24);
		}
		if(waist>23){
			waistI = 1 - ((waist - 24) / 24);
		}
		if(hips<=36){
			hipsI = 1 - ((36 - hips) / 36);
		}
		if(hips>36){
			hipsI = 1 - ((hips - 36) / 36);
		}
		double temp;
		temp = bustI + waistI + hipsI;
		return temp / 3;
	
	}
	/*public void userInput(){
		name = JOptionPane.showInputDialog("Enter name:");
		bust = Double.parseDouble(JOptionPane.showInputDialog("Enter bust size:"));
		waist = Double.parseDouble(JOptionPane.showInputDialog("Enter waist size:"));
		hips = Double.parseDouble(JOptionPane.showInputDialog("Enter hips size:"));
		cI = solve(bust, waist, hips);
	}*/
	public String toString(){
	
		return "Name: " + name + "\nBust: " + bust + "\nWaist: " + waist + "\nHips: " + hips + "\nCurvature Index: " + cI;
	}
	/*public double getcI(){
		return cI;
	}*/
	public boolean equals(Node o){
		if(name.equals(o.name)){
			return true;
		}else{
			return false;
		}
	}
	/*public String getName(){
		return name;
	}*/
	
}